<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Matrix207&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Matrix207's Blog">
<meta property="og:url" content="http://yoursite.com/page/7/index.html">
<meta property="og:site_name" content="Matrix207's Blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Matrix207's Blog">
  
    <link rel="alternate" href="/atom.xml" title="Matrix207&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Matrix207&#39;s Blog</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="Flux RSS"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Rechercher"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-speed-for-getting-info-from-pipe-and-proc-system" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/08/08/speed-for-getting-info-from-pipe-and-proc-system/" class="article-date">
  <time datetime="2014-08-07T16:00:00.000Z" itemprop="datePublished">2014-08-08</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/08/08/speed-for-getting-info-from-pipe-and-proc-system/">speed for getting info from pipe and proc system</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Test-code"><a href="#Test-code" class="headerlink" title="Test code"></a>Test code</h3><p>compile with <code>gcc -Wall -o test test.c</code></p>
<p>The include file time_test.h, can be got frome<br><a href="https://github.com/matrix207/C/blob/master/util/time_test.h" target="_blank" rel="external">https://github.com/matrix207/C/blob/master/util/time_test.h</a></p>
<pre><code>#include &lt;stdio.h&gt;  
#include &lt;stdlib.h&gt;  
#include &lt;string.h&gt;  
#include &lt;pthread.h&gt;
#include &lt;sys/types.h&gt;  
#include &lt;sys/stat.h&gt;  
#include &lt;fcntl.h&gt;  
#include &lt;unistd.h&gt;  
#include &lt;signal.h&gt;  
#include &lt;sys/socket.h&gt;
#include &lt;sys/wait.h&gt;
#include &lt;arpa/inet.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;net/if.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &quot;time_test.h&quot;

int exec_cmd(const char *cmd, char *result, const int size)
{
    FILE *fp = NULL;

    if (cmd == NULL) {
        printf(&quot;cmd can not be NULL\n&quot;);
        return 1;
    }

    if (NULL == (fp = popen(cmd, &quot;r&quot;))) {
        fprintf(stdout, &quot;Fail to do %s\n&quot;, cmd);
        return 1;
    }

    memset(result, 0, size);
    printf(&quot;-------1-------\n&quot;);
    fgets(result, size, fp);
    printf(&quot;-------2-------\n&quot;);

    pclose(fp);
    return 0;
}

void get_from_proc(char *interface)
{
    int sockfd;
    struct ifreq ifr;
    char mac_addr[30]={0};

    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if( sockfd == -1) {
        perror(&quot;create socket falise...mac\n&quot;);
        return; 
    }

    memset(&amp;ifr,0,sizeof(ifr));
    strncpy(ifr.ifr_name, interface, sizeof(ifr.ifr_name)-1);

    if ((ioctl(sockfd, SIOCGIFHWADDR, &amp;ifr)) &lt; 0) {
        printf(&quot;mac ioctl error\n&quot;);
        return;
    }

    snprintf(mac_addr, sizeof(mac_addr), &quot;%02x%02x%02x%02x%02x%02x&quot;,  
            (unsigned char)ifr.ifr_hwaddr.sa_data[0],
            (unsigned char)ifr.ifr_hwaddr.sa_data[1],
            (unsigned char)ifr.ifr_hwaddr.sa_data[2],
            (unsigned char)ifr.ifr_hwaddr.sa_data[3],
            (unsigned char)ifr.ifr_hwaddr.sa_data[4],
            (unsigned char)ifr.ifr_hwaddr.sa_data[5]);

    printf(&quot;local mac:%s \n&quot;,mac_addr);

    char *address;
    struct sockaddr_in *addr;
    if (ioctl(sockfd,SIOCGIFADDR,&amp;ifr) == -1)
        perror(&quot;ioctl error&quot;),exit(1);
    addr = (struct sockaddr_in *)&amp;(ifr.ifr_addr);
    address = inet_ntoa(addr-&gt;sin_addr);
    printf(&quot;inet addr: %s \n&quot;,address);

    close(sockfd);
}

void get_from_pipe(char *interface)
{
    char cmd[100] = {0};
    /* char *format=&quot;ifconfig %s |grep %s |awk &apos;{print $5}&apos;&quot;; */
    char *format=&quot;ifconfig %s |grep ether |awk &apos;{print $2}&apos;&quot;;
    snprintf(cmd, sizeof(cmd), format, interface, interface); 
    char result[150] = {0};
    if (0 == exec_cmd(cmd, result, sizeof(result))) {
        printf(&quot;mac is %s\n&quot;, result);
    } else {
        printf(&quot;Fail\n&quot;);
    }
}

void time_test(int argc,char **argv)
{
    /* XXX: change this for your computer */
    char *interface = &quot;p4p1&quot;;
    if (argc == 2)
        interface = argv[1];

    TIME_START();
    printf(&quot;---------from proc system---------\n&quot;);
    get_from_proc(interface);
    TIME_END();

    TIME_START();
    printf(&quot;---------from pipe---------\n&quot;);
    get_from_pipe(interface);
    TIME_END();
}

int main(int argc,char **argv)
{
    time_test(argc, argv);
    return 0;
}
</code></pre><h3 id="Test-detail"><a href="#Test-detail" class="headerlink" title="Test detail"></a>Test detail</h3><p>Using strace to log system calling time (output to file 1.log)</p>
<p><code>strace -tT -o 1.log ./test</code></p>
<p>The log info we care list as below:</p>
<pre><code>11:00:47 write(1, &quot;---------from proc system-------&quot;..., 35) = 35 &lt;0.000030&gt;
11:00:47 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 &lt;0.000049&gt;
11:00:47 ioctl(3, SIOCGIFHWADDR, {ifr_name=&quot;p4p1&quot;, ifr_hwaddr=00:23:ae:96:d6:9a}) = 0 &lt;0.000012&gt;
11:00:47 write(1, &quot;local mac:0023ae96d69a \n&quot;, 24) = 24 &lt;0.000018&gt;
11:00:47 ioctl(3, SIOCGIFADDR, {ifr_name=&quot;p4p1&quot;, ifr_addr={AF_INET, inet_addr(&quot;172.16.50.39&quot;)}}) = 0 &lt;0.000013&gt;
11:00:47 write(1, &quot;inet addr: 172.16.50.39 \n&quot;, 25) = 25 &lt;0.000021&gt;
11:00:47 close(3)                       = 0 &lt;0.000019&gt;
11:00:47 write(1, &quot;Elapsed time 471 usec\n&quot;, 22) = 22 &lt;0.000017&gt;
11:00:47 write(1, &quot;---------from pipe---------\n&quot;, 28) = 28 &lt;0.000018&gt;
11:00:47 brk(0)                         = 0x1af3000 &lt;0.000009&gt;
11:00:47 brk(0x1b14000)                 = 0x1b14000 &lt;0.000010&gt;
11:00:47 brk(0)                         = 0x1b14000 &lt;0.000007&gt;
11:00:47 pipe2([3, 4], O_CLOEXEC)       = 0 &lt;0.000014&gt;
11:00:47 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f6bff5eaa10) = 7658 &lt;0.000077&gt;
11:00:47 close(4)                       = 0 &lt;0.000008&gt;
11:00:47 fcntl(3, F_SETFD, 0)           = 0 &lt;0.000007&gt;
11:00:47 write(1, &quot;-------1-------\n&quot;, 16) = 16 &lt;0.000020&gt;
11:00:47 fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 &lt;0.001732&gt;
11:00:47 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6bff603000 &lt;0.000016&gt;
11:00:47 read(3, &quot;00:23:ae:96:d6:9a\n&quot;, 4096) = 18 &lt;0.003692&gt;
11:00:47 write(1, &quot;-------2-------\n&quot;, 16) = 16 &lt;0.000170&gt;
11:00:47 close(3)                       = 0 &lt;0.000009&gt;
11:00:47 wait4(7658, [{WIFEXITED(s) &amp;&amp; WEXITSTATUS(s) == 0}], 0, NULL) = 7658 &lt;0.000043&gt;
11:00:47 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=7658, si_status=0, si_utime=0, si_stime=0} ---
11:00:47 munmap(0x7f6bff603000, 4096)   = 0 &lt;0.000018&gt;
11:00:47 write(1, &quot;mac is 00:23:ae:96:d6:9a\n&quot;, 25) = 25 &lt;0.000018&gt;
11:00:47 write(1, &quot;\n&quot;, 1)              = 1 &lt;0.000014&gt;
11:00:47 write(1, &quot;Elapsed time 6639 usec\n&quot;, 23) = 23 &lt;0.000022&gt;
</code></pre><p>find the max 10 time by <code>awk &#39;{print $NF}&#39; 1.log |sort |tail</code></p>
<pre><code>&lt;0.000021&gt;
&lt;0.000022&gt;
&lt;0.000030&gt;
&lt;0.000043&gt;
&lt;0.000049&gt;
&lt;0.000077&gt;
&lt;0.000164&gt;
&lt;0.000170&gt;
&lt;0.001732&gt;
&lt;0.003692&gt;
</code></pre><p>then find the time killer <code>grep -E &quot;001732|003692&quot; 1.log</code></p>
<pre><code>11:00:47 fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 &lt;0.001732&gt;
11:00:47 read(3, &quot;00:23:ae:96:d6:9a\n&quot;, 4096) = 18 &lt;0.003692&gt;
</code></pre><p>so, we know that the killer code is </p>
<pre><code>fgets(result, size, fp);
</code></pre><p>If we using much code for our programming, and time is what we should care about,<br>then avoid pipe code as possible as we can.</p>
<h3 id="TODO"><a href="#TODO" class="headerlink" title="TODO"></a>TODO</h3><ol>
<li>Is each system call have fixed time?(ofcourse, there should be a litter<br>different for each testing)</li>
<li>Sort the time elapse for all the system call</li>
</ol>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/08/08/speed-for-getting-info-from-pipe-and-proc-system/" data-id="ciqqpe1qq00ainmpvc2xmjlo0" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/performance/">performance</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-megacli-common-command-and-procedures" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/08/07/megacli-common-command-and-procedures/" class="article-date">
  <time datetime="2014-08-06T16:00:00.000Z" itemprop="datePublished">2014-08-07</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/storage/">storage</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/08/07/megacli-common-command-and-procedures/">MegaCli Common Command and Procedures</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>From <strong><a href="https://supportforums.cisco.com/document/62901/megacli-common-commands-and-procedures" target="_blank" rel="external">MegaCli Common Commands and Procedures</a></strong></p>
<h3 id="Introduction"><a href="#Introduction" class="headerlink" title="Introduction"></a>Introduction</h3><p>MegaCli commands have presented a number of questions among our users for Cisco’s<br>Physical Security.  Here is an attempt to explain thier meaning and uses.</p>
<p>See also: Cisco VSM RAID Viewer</p>
<h3 id="General-Parameters"><a href="#General-Parameters" class="headerlink" title="General Parameters"></a>General Parameters</h3><pre><code>Adapter parameter -aN 
</code></pre><p>The parameter -aN (where N is a number starting with zero or the string ALL)<br>specifies the adapter ID. If you have only one controller it’s safe to use ALL<br>instead of a specific ID, but you’re encouraged to use the ID for everything<br>that makes changes to your RAID configuration.</p>
<pre><code>Physical drive parameter      -PhysDrv [E:S] 
</code></pre><p>For commands that operate on one or more pysical drives, the -PhysDrv [E:S]<br>parameter is used, where E is the enclosure device ID in which the drive resides<br>and S the slot number (starting with zero). You can get the enclosure device ID<br>using MegaCli -EncInfo -aALL. The E:S syntax is also used for specifying the<br>physical drives when creating a new RAID virtual drive (see 5).</p>
<pre><code>Virtual drive parameter -Lx 
</code></pre><p>The parameter -Lx is used for specifying the virtual drive (where x is a number<br>starting with zero or the string all).</p>
<p>Running the executable can be accomplished by:</p>
<pre><code>shell&gt; /opt/MegaRAID/MegaCli/MegaCli &lt;cmd&gt;
</code></pre><p>or</p>
<pre><code>shell&gt; cd /opt/MegaRAID/MegaCli
shell&gt; ./MegaCli &lt;cmd&gt;
</code></pre><h3 id="Gather-information"><a href="#Gather-information" class="headerlink" title="Gather information"></a>Gather information</h3><p>Controller information </p>
<pre><code>MegaCli -AdpAllInfo -aALL
MegaCli -CfgDsply -aALL
MegaCli -adpeventlog -getevents -f lsi-events.log -a0 -nolog
</code></pre><p>Enclosure information </p>
<pre><code>MegaCli -EncInfo -aALL
</code></pre><p>Virtual drive information </p>
<pre><code>MegaCli -LDInfo -Lall -aALL
</code></pre><p>Physical drive information </p>
<pre><code>MegaCli -PDList -aALL

MegaCli -PDInfo -PhysDrv [E:S] -aALL
</code></pre><p>Battery backup information (Cisco MSPs do not have the battery backup unit<br>installed, but in case yours has one) </p>
<pre><code>MegaCli -AdpBbuCmd -aALL 
</code></pre><p>Check Battery backup warning on boot.  If this is enabled on an MSP, it will<br>require manual intervention every time the system boots</p>
<pre><code>MegaCli -AdpGetProp BatWarnDsbl -a0 
</code></pre><h3 id="Controller-management"><a href="#Controller-management" class="headerlink" title="Controller management"></a>Controller management</h3><p>Silence active alarm </p>
<pre><code>MegaCli -AdpSetProp AlarmSilence -aALL
</code></pre><p>Disable alarm </p>
<pre><code>MegaCli -AdpSetProp AlarmDsbl -aALL
</code></pre><p>Enable alarm </p>
<pre><code>MegaCli -AdpSetProp AlarmEnbl -aALL 
</code></pre><p>Disable battery backup warning on system boot</p>
<pre><code>MegaCli -AdpSetProp BatWarnDsbl -a0
</code></pre><p>Change the adapter rebuild rate to 60%:</p>
<pre><code>MegaCli -AdpSetProp {RebuildRate -60} -aALL
</code></pre><h3 id="Virtual-drive-management"><a href="#Virtual-drive-management" class="headerlink" title="Virtual drive management"></a>Virtual drive management</h3><p>Create RAID 0, 1, 5 drive </p>
<pre><code>MegaCli -CfgLdAdd -r(0|1|5) [E:S, E:S, ...] -aN
</code></pre><p>Create RAID 10 drive </p>
<pre><code>MegaCli -CfgSpanAdd -r10 -Array0[E:S,E:S] -Array1[E:S,E:S] -aN
</code></pre><p>Remove drive </p>
<pre><code>MegaCli -CfgLdDel -Lx -aN 
</code></pre><h3 id="Physical-drive-management"><a href="#Physical-drive-management" class="headerlink" title="Physical drive management"></a>Physical drive management</h3><p>Set state to offline </p>
<pre><code>MegaCli -PDOffline -PhysDrv [E:S] -aN
</code></pre><p>Set state to online </p>
<pre><code>MegaCli -PDOnline -PhysDrv [E:S] -aN
</code></pre><p>Mark as missing </p>
<pre><code>MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
</code></pre><p>Prepare for removal </p>
<pre><code>MegaCli -PdPrpRmv -PhysDrv [E:S] -aN
</code></pre><p>Replace missing drive </p>
<pre><code>MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
</code></pre><p>The number N of the array parameter is the Span Reference you get using<br><strong>MegaCli -CfgDsply -aALL</strong> and the number N of the row parameter is the<br>Physical Disk in that span or array starting with zero (it’s not the physical<br>disk’s slot!).</p>
<p>Rebuild drive - Drive status should be “Firmware state: Rebuild”</p>
<pre><code>MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
MegaCli -PDRbld -Stop -PhysDrv [E:S] -aN
MegaCli -PDRbld -ShowProg -PhysDrv [E:S] -aN     
MegaCli -PDRbld -ProgDsply -physdrv [E:S] -aN
</code></pre><p>Clear drive </p>
<pre><code>MegaCli -PDClear -Start -PhysDrv [E:S] -aN
MegaCli -PDClear -Stop -PhysDrv [E:S] -aN
MegaCli -PDClear -ShowProg -PhysDrv [E:S] -aN
</code></pre><p>Bad to good </p>
<pre><code>MegaCli -PDMakeGood -PhysDrv[E:S] -aN
</code></pre><p>Changes drive in state Unconfigured-Bad to Unconfigured-Good.</p>
<h3 id="Hot-spare-management"><a href="#Hot-spare-management" class="headerlink" title="Hot spare management"></a>Hot spare management</h3><p>Set global hot spare </p>
<pre><code>MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
</code></pre><p>Remove hot spare </p>
<pre><code>MegaCli -PDHSP -Rmv -PhysDrv [E:S] -aN
</code></pre><p>Set dedicated hot spare </p>
<pre><code>MegaCli -PDHSP -Set -Dedicated -ArrayN,M,... -PhysDrv [E:S] -aN 
</code></pre><h3 id="Walkthrough-Rebuild-a-Drive-that-is-marked-‘Foreign’-when-Inserted"><a href="#Walkthrough-Rebuild-a-Drive-that-is-marked-‘Foreign’-when-Inserted" class="headerlink" title="Walkthrough: Rebuild a Drive that is marked ‘Foreign’ when Inserted:"></a>Walkthrough: Rebuild a Drive that is marked ‘Foreign’ when Inserted:</h3><ul>
<li><p>Bad to good </p>
<p>  MegaCli -PDMakeGood -PhysDrv [E:S]  -aALL</p>
</li>
<li><p>Clear the foreign setting</p>
<p>  MegaCli -CfgForeign -Clear -aALL</p>
</li>
<li><p>Set global hot spare </p>
<p>   MegaCli -PDHSP -Set -PhysDrv [E:S] -aN</p>
</li>
</ul>
<h3 id="Walkthrough-Change-replace-a-drive"><a href="#Walkthrough-Change-replace-a-drive" class="headerlink" title="Walkthrough: Change/replace a drive"></a>Walkthrough: Change/replace a drive</h3><p>1.Set the drive offline, if it is not already offline due to an error</p>
<pre><code>MegaCli -PDOffline -PhysDrv [E:S] -aN
</code></pre><p>2.Mark the drive as missing</p>
<pre><code>MegaCli -PDMarkMissing -PhysDrv [E:S] -aN
</code></pre><p>3.Prepare drive for removal</p>
<pre><code>MegaCli -PDPrpRmv -PhysDrv [E:S] -aN
</code></pre><p>4.Change/replace the drive</p>
<p>5.If you’re using hot spares then the replaced drive should become your new hot spare drive</p>
<pre><code>MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
</code></pre><p>6.In case you’re not working with hot spares, you must re-add the new drive to<br>your RAID virtual drive and start the rebuilding</p>
<pre><code>MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
</code></pre><h3 id="Gathering-Standard-logs"><a href="#Gathering-Standard-logs" class="headerlink" title="Gathering Standard logs"></a>Gathering Standard logs</h3><p>On every instance of a hard drive problem with an MSP server, we need to run the<br>following commands to have any information about the problem:</p>
<pre><code>shell&gt; rm –f MegaSAS.log

shell&gt; /opt/MegaRAID/MegaCli/MegaCli -adpallinfo -a0

shell&gt; /opt/MegaRAID/MegaCli/MegaCli -encinfo -a0

shell&gt; /opt/MegaRAID/MegaCli/MegaCli -ldinfo -lall -a0

shell&gt; /opt/MegaRAID/MegaCli/MegaCli -pdlist -a0

shell&gt; /opt/MegaRAID/MegaCli/MegaCli -adpeventlog -getevents -f lsi-events.log -a0 -nolog

shell&gt; /opt/MegaRAID/MegaCli/MegaCli -fwtermlog -dsply -a0 -nolog &gt; lsi-fwterm.log
</code></pre><p>Collect the MegaSAS.log, lsi-events.log, and the lsi-fwterm.log files from the<br>directory where the commands are run (they can be run from any directory on the<br>MSP server) and attach the logs to the service request. You may use a program<br>such as WinSCP (freeware) to pull the files off of the server.</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/08/07/megacli-common-command-and-procedures/" data-id="ciqqpe1qn00afnmpvzkstimq0" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/storage/">storage</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-linux-memory-performance-monitor" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/07/30/linux-memory-performance-monitor/" class="article-date">
  <time datetime="2014-07-29T16:00:00.000Z" itemprop="datePublished">2014-07-30</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/07/30/linux-memory-performance-monitor/">Linux Memory performance monitor</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="What-your-should-know"><a href="#What-your-should-know" class="headerlink" title="What your should know"></a>What your should know</h3><h3 id="Tools"><a href="#Tools" class="headerlink" title="Tools"></a>Tools</h3><ul>
<li>vmstat </li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://os.51cto.com/art/201012/239883.htm" target="_blank" rel="external">Linux性能监测：内存篇</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/07/30/linux-memory-performance-monitor/" data-id="ciqqpe1qk00acnmpv1n87ir99" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/performance/">performance</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-linux-io-performance-monitor" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/07/30/linux-io-performance-monitor/" class="article-date">
  <time datetime="2014-07-29T16:00:00.000Z" itemprop="datePublished">2014-07-30</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/storage/">storage</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/07/30/linux-io-performance-monitor/">Linux IO performance monitor</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="What-your-should-know"><a href="#What-your-should-know" class="headerlink" title="What your should know"></a>What your should know</h3><ul>
<li><p>Your system parameters:</p>
<ul>
<li>storage device: HDD, SSD (which?), Raid (which?)</li>
<li>filesystem, block size, journal mode</li>
<li>file cache, dirty thresholds, amount of memory</li>
<li>IO scheduler, its tunables</li>
<li>number of CPUs</li>
<li>kernel version</li>
</ul>
</li>
<li><p>Your test parameters:</p>
<ul>
<li>read or write performance?</li>
<li>sequential or random?</li>
<li>1 thread or multiple?</li>
<li>size of requests</li>
<li>optimize for throughput or request delay?</li>
</ul>
</li>
<li><p>IO’s Per Second（IOPS） </p>
<ul>
<li>IOPS=1000/(tseek+trotation+transfer), tseek:3~15ms, trotation:2ms, Transfer&lt;&lt;1<br>IOPS=1000/(5+2)=142</li>
</ul>
</li>
<li><p>random io and sequential io</p>
</li>
</ul>
<h3 id="Monitor"><a href="#Monitor" class="headerlink" title="Monitor"></a>Monitor</h3><ul>
<li><p>start from dd test (install centos 7 to u-disk)</p>
<p>  [root@localhost Downloads]# dd if=/home/dennis/Downloads/CentOS-7.0-1406-x86_64-DVD.iso of=/dev/sdc</p>
</li>
<li><p>using /proc/diskstats</p>
<pre><code>[dennis@localhost Downloads]$ cat /proc/diskstats
   8   0 sda 141736 59689 8916560 2493999 102005 133358 13766420 6019722 1 954049 8513774
   8   1 sda1 286 562 3822 5720 7 1 28 156 0 4959 5875
   8   2 sda2 141324 59017 8910850 2482584 90409 133357 13766392 5797210 1 762103 8279724
 253   0 dm-0 14247 0 113976 102438 61899 0 495192 6397303 0 45071 6499746
 253   1 dm-1 151287 0 5630082 3598603 47156 0 1021320 5247386 0 551034 8846229
 253   2 dm-2 35848 0 3166248 352901 115404 0 12249880 2422762 1 524204 2775689
   8  16 sdb 152 871 2311 604 0 0 0 0 0 564 604
   8  17 sdb1 70 801 1095 280 0 0 0 0 0 262 280
   8  32 sdc 248265 108 1986984 316895 5710 170143 1370400 48417446 158 346876 49258416
   8  33 sdc1 248249 108 1986856 316866 5710 170143 1370400 48417446 158 346847 49258387
</code></pre></li>
</ul>
<pre><code>- [dennis@localhost Downloads]$ cat /proc/diskstats | grep &quot;sdc &quot;
  下面的显示去掉了 &quot;8   32 sd &quot;
  +   1     2    3        4    5     6        7      8       9     10      11
  + 132725 108 1062664 167643 2681  81983  643440  24022041  147 177399  24801880
  + 274044 108 2193216 348847 6582  195199 1579680 54459810  150 388700  55296467
  + 480307 108 3843320 608357 13408 392863 3217920 101917275 139 719423  103013695
  + 636845 108 5095624 802159 18568 542271 4456320 138060107 132 971278  139338459 
  + 717802 108 5743280 902925 21254 620223 5100960 156763894 134 1101859 158182895 
- 第1个域：读完成次数 ----- 读磁盘的次数，成功完成读的总次数。
- 第2个域：合并读完成次数， 第6个域：合并写完成次数。为了效率可能会合并相邻
           的读和写。从而两次4K的读在它最终被处理到磁盘上之前可能会变成一次
           8K的读，才被计数（和排队），因此只有一次I/O操作。这个域使你知
  道这样的操作有多频繁。
- 第3个域：读扇区的次数，成功读过的扇区总次数。
- 第4个域：读花费的毫秒数，这是所有读操作所花费的毫秒数
           (用make_request()到end_that_request_last()测量)
- 第5个域：写完成次数 ----写完成的次数，成功写完成的总次数。
- 第6个域：合并写完成次数 -----合并写次数。
- 第7个域：写扇区次数 ---- 写扇区的次数，成功写扇区总次数。
- 第8个域：写操作花费的毫秒数  ---  写花费的毫秒数，这是所有写操作所花费的毫秒数
- 第9个域：正在处理的输入/输出请求数 -- -I/O的当前进度，只有这个域应该是0。
           当请求被交给适当的request_queue_t时增加和请求完成时减小。
- 第10个域：输入/输出操作花费的毫秒数  ----花在I/O操作上的毫秒数，这个域会增长只要field 9不为0。
- 第11个域：输入/输出操作花费的加权毫秒数 -----  加权，花在I/O操作上的毫秒数，
            在每次I/O开始，I/O结束，I/O合并时这个域都会增加。这可以给I/O完成
            时间和存储那些可以累积的提供一个便利的测量标准。
</code></pre><ul>
<li><p>using vmstat</p>
<pre><code>[dennis@localhost Downloads]$ vmstat 1 10
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so   bi    bo   in   cs us sy id wa
 0  2 262060  79832 1290864 736688  0    2    82    80  165  143  5  1 92  2
 0  2 262060  81964 1279336 746696  0    0  5176  3840 5693 10504  5 10 23 62
 0  2 262060  75888 1282288 749680  0    0  5896  3840 5259 11483  5  5 41 49
 0  2 262060  70184 1285204 752636  0    0  5860     0 5213 11354  6  2 39 53
 1  2 262060  79092 1281472 747172  0    0  5668  3904 5047 11017  5  4 43 49
 1  2 262060  79584 1284256 743532  0    0  5832     0 5004 11202  5  2 43 50
 0  2 262060  77532 1287020 742796  0    0  5672  3840 5126 11111  6  3 39 53
 0  2 262060  79668 1289484 738468  0    0  5316     0 5598 10422  5  5 23 68
 0  2 262060  79536 1290632 737000  0    0  5180  3840 4860 10482  6  3 41 50
 0  2 262060  79880 1291936 735188  0    0  5160     0 5469 10400  5  6 27 62

[dennis@localhost Downloads]$ vmstat -d
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms   cur   sec
sda   188079  70330 16034138 2811643 108057 169484 14406740 8013520   0  1118
dm-0   15970      0  127760  112213  93653      0  749224  16348510   0    70
dm-1  181140      0 6578234 4012264  51721      0 1236960   7818610   0   681
dm-2   61516      0 9321616  477028 121227      0 12420520  2505467   0   622
sdb      152    871    2311     604      0      0       0         0   0     0
sdc   1012855   108 8103704 1284706  33810 978925 8101888 241555468   0  1636
</code></pre></li>
<li><p>using top(using <code>man top</code> for help)   </p>
</li>
<li><p>using iostat(using <code>man iostat</code> for help)   </p>
<pre><code>[dennis@localhost Downloads]$ su -c &apos;yum install sysstat -y&apos;
[dennis@localhost Downloads]$ iostat -x 1 3
Linux 3.15.6-200.fc20.x86_64 (localhost.localdomain)     07/30/2014     _x86_64_    (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           4.59    0.15    1.48    2.20    0.00   91.59

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.46     1.11    1.25    0.72    53.26    48.59   103.44     0.07   36.97   15.02   75.16   3.76   0.74
dm-0              0.00     0.00    0.10    0.61     0.42     2.43     8.00     0.11  156.53    7.06  182.19   0.65   0.05
dm-1              0.00     0.00    1.21    0.34    21.67     4.18    33.36     0.08   51.41   22.36  152.90   2.90   0.45
dm-2              0.00     0.00    0.41    0.80    31.16    41.98   120.98     0.02   16.56    7.58   21.12   3.43   0.41
sdb               0.01     0.00    0.00    0.00     0.01     0.00    15.20     0.00    3.97    3.97    0.00   3.71   0.00
sdc               0.00     6.08    6.77    0.21    27.07    25.02    14.94     1.52  217.29    1.27 7226.26   1.52   1.06

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           2.91    0.00    9.22   52.91    0.00   34.95

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00   660.00   22.00    8.00  2816.00  3404.00   414.67     0.08    2.83    0.50    9.25   1.63   4.90
dm-0              0.00     0.00    0.00  666.00     0.00  2664.00     8.00     7.13   10.84    0.00   10.84   0.06   3.80
dm-1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-2              0.00     0.00   22.00    0.00  2816.00     0.00   256.00     0.01    0.50    0.50    0.00   0.50   1.10
sdb               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
sdc               0.00     0.00  719.00   15.00  2876.00  1800.00    12.74   150.38  197.33    1.32 9592.53   1.36 100.00

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           3.06    0.00    3.57   51.02    0.00   42.35

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00   23.00    1.00  2944.00     4.00   245.67     0.01    0.50    0.52    0.00   0.50   1.20
dm-0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-1              0.00     0.00    0.00    1.00     0.00     4.00     8.00     0.00    0.00    0.00    0.00   0.00   0.00
dm-2              0.00     0.00   23.00    0.00  2944.00     0.00   256.00     0.01    0.52    0.52    0.00   0.52   1.20
sdb               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
sdc               0.00   928.00  733.00   15.00  2932.00  1800.00    12.65   136.75  211.08    1.36 10459.40   1.34 100.00
[dennis@localhost Downloads]$ watch iostat -x 
</code></pre></li>
<li><p>using shell script monitor_io_stats.sh</p>
<pre><code>#!/bin/sh
/etc/init.d/syslog stop
echo 1 &gt; /proc/sys/vm/block_dump
sleep 60
dmesg | awk &apos;/(READ|WRITE|dirtied)/ {process[$1]++} END {for (x in process) \
print process[x],x}&apos; |sort -nr |awk &apos;{print $2 &quot; &quot; $1}&apos; | \
head -n 10
echo 0 &gt; /proc/sys/vm/block_dump
/etc/init.d/syslog start
</code></pre></li>
</ul>
<h3 id="Other-tools"><a href="#Other-tools" class="headerlink" title="Other tools"></a>Other tools</h3><ul>
<li><p>IOMeter, using for testing block device</p>
<ul>
<li>Test parameters<ul>
<li>of Outstanding I/Os, using <code>8</code> per target</li>
<li>each worker select one target?</li>
<li>100% Write or 100% Read</li>
<li>Sequential or Random</li>
<li>Transfer Request Size using 1MB</li>
<li>Result Since, select <code>Last Update</code></li>
<li>Update Frequency(seconds) select <code>1</code></li>
</ul>
</li>
</ul>
</li>
<li><p>SANergy, using for testing filesystem(Samba)</p>
<ul>
<li>Select <code>Performance Tester</code></li>
<li>Select driver(mapping the director as a driver, such as Z)</li>
<li>Select <code>Read test</code> or <code>Write test</code></li>
<li>File size(MB) using <code>10240</code></li>
<li>Record size(KB) using <code>1024</code></li>
<li>select ‘Loop’</li>
<li>start test</li>
</ul>
</li>
<li><p>Iozone: a filesystem benchmark tool</p>
<ul>
<li>download from <a href="http://www.iozone.org/src/current/" target="_blank" rel="external">http://www.iozone.org/src/current/</a></li>
<li>compile source code: <code>make linux-AMD64</code>(NOTICE: check you cpu model and select correct command for compile)</li>
<li>test for nfs<ul>
<li>showmount -e 172.16.130.111</li>
<li>mkdir /mnt/nastest</li>
<li>mount -t nfs 172.16.130.111:/share/nfs1 /mnt/nastest</li>
<li>./iozone -az -b /mnt/nastest/test.xls -g 256G -y 32k -i 0 -i 1   </li>
</ul>
</li>
</ul>
</li>
<li><p>FIO  </p>
<ul>
<li>read: <code>fio --filename=/dev/sda3 --direct=1 --iodepth 1 --thread --rw=read --ioengine=psync --bs=4k --size=2G --numjobs=10 --runtime=100 --group_reporting --name=mytest</code></li>
<li>write: <code>fio --filename=/dev/sda3 --direct=1 --iodepth 1 --thread --rw=write --ioengine=psync --bs=4k --size=2G --numjobs=10 --runtime=100 --group_reporting --name=mytest</code></li>
<li>random read: <code>fio --filename=/dev/sda3 --direct=1 --iodepth 1 --thread --rw=randread --ioengine=psync --bs=4k --size=2G --numjobs=10 --runtime=100 --group_reporting --name=mytest</code></li>
<li>random write: <code>fio --filename=/dev/sda3 --direct=1 --iodepth 1 --thread --rw=randwrite --ioengine=psync --bs=4k --size=2G --numjobs=10 --runtime=100 --group_reporting --name=mytest</code></li>
<li>Mix random read and write: <code>fio --filename=/dev/sda3 --direct=1 --iodepth 1 --thread --rw=randrw --rwmixread=70 --ioengine=psync --bs=4k --size=2G --numjobs=10 --runtime=100 --group_reporting --name=mytest --ioscheduler=noop</code></li>
</ul>
</li>
<li><p>blktrace: is a block layer IO tracing mechanism which provides detailed information  </p>
<pre><code>about request queue operations up to user space.
</code></pre><ul>
<li>read: <code>fio --filename=/dev/sda3 --direct=1 --iodepth 1 --thread --rw=read --ioengine=psync --bs=4k --size=2G --numjobs=10 --runtime=100 --group_reporting --name=mytest</code></li>
</ul>
</li>
</ul>
<h3 id="Example"><a href="#Example" class="headerlink" title="Example"></a>Example</h3><ul>
<li><p>Troubleshooting high <code>uitl</code> of <code>iostat</code> command</p>
<ul>
<li>using <code>iostat -x 2 5</code> to view the disk information</li>
</ul>
</li>
<li><p>Troubleshooting high <code>uitl</code> of <code>iostat</code> command</p>
</li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://os.51cto.com/art/201012/239886.htm" target="_blank" rel="external">Linux性能监测：磁盘IO篇</a></li>
<li><a href="http://www.tecmint.com/linux-performance-monitoring-with-vmstat-and-iostat-commands/" target="_blank" rel="external">Linux Performance Monitoring with Vmstat and Iostat Commands</a></li>
<li><a href="http://www.cnblogs.com/mfryf/archive/2012/03/12/2392012.html" target="_blank" rel="external">查看linux服务器硬盘IO读写负载</a></li>
<li><a href="http://blog.csdn.net/tenfyguo/article/details/7477526" target="_blank" rel="external">/proc/diskstats</a></li>
<li><a href="http://stackoverflow.com/a/3549620" target="_blank" rel="external">Testing IO performance in Linux</a></li>
<li><a href="http://www.jb51.net/LINUXjishu/65741.html" target="_blank" rel="external">linux 查看磁盘IO状态操作指南</a></li>
<li><a href="http://bannaych.blogspot.jp/2005/12/random-and-sequential-io.html" target="_blank" rel="external">random and sequential io</a></li>
<li><a href="http://en.wikipedia.org/wiki/Hard_disk_drive#Seek_time" target="_blank" rel="external">hdd seek time</a></li>
<li><a href="https://www.usenix.org/legacy/events/fast04/tech/full_papers/radkov/radkov_html/node14.html" target="_blank" rel="external">impact of sequential and random io</a></li>
<li><a href="http://wushank.blog.51cto.com/3489095/1585927" target="_blank" rel="external">linux下的CPU、内存、IO、网络的压力测试</a></li>
<li><a href="http://blog.csdn.net/liuaigui/article/details/6168186" target="_blank" rel="external">磁盘IOPS计算与测量</a></li>
<li><a href="http://dadaru.blog.51cto.com/218979/481394" target="_blank" rel="external">http://dadaru.blog.51cto.com/218979/481394</a></li>
<li><a href="http://dadaru.blog.51cto.com/218979/481394" target="_blank" rel="external">系统性能分析工具&amp;&amp;一些我对磁盘IOPS的简单认识</a></li>
<li><a href="http://www.dbabeta.com/2009/io-performence-01_several-concepts.html" target="_blank" rel="external">IO系统性能之一：衡量性能的几个指标</a></li>
<li><a href="http://blog.yufeng.info/archives/tag/fio" target="_blank" rel="external">fio性能测试工具新添图形前端gfio</a></li>
<li><a href="http://blog.itpub.net/26855487/viewspace-754346/" target="_blank" rel="external">linux 使用FIO测试磁盘iops</a></li>
<li>★★★<a href="http://bencane.com/2012/08/06/troubleshooting-high-io-wait-in-linux/" target="_blank" rel="external">Troubleshooting High I/O Wait in Linux</a></li>
<li>★★★<a href="http://blogread.cn/it/article/6145" target="_blank" rel="external">通过blktrace, debugfs分析磁盘IO</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/07/30/linux-io-performance-monitor/" data-id="ciqqpe1qi00a9nmpv27wchjc7" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/performance/">performance</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-data-structures-relation-to-image" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/07/28/data-structures-relation-to-image/" class="article-date">
  <time datetime="2014-07-27T16:00:00.000Z" itemprop="datePublished">2014-07-28</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/07/28/data-structures-relation-to-image/">data structures relation to image</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="What-it-is"><a href="#What-it-is" class="headerlink" title="What it is"></a>What it is</h3><p><strong>ds2img</strong>.py (DataStructure To Image) </p>
<p>A python script transfer c header file which contains lots of data structures<br>to a dot script, and then use dot to convert to a image file</p>
<h3 id="How-to-run"><a href="#How-to-run" class="headerlink" title="How to run"></a>How to run</h3><pre><code>Usage: ds2imgpy -i INPUT_FILE -f png|svg -o OUTPUT_FILE [-d DOT_FILE]

-i  input file which have structures&quot;
-f  image fomat, only support png and svg&quot;
-o  output file, image file&quot;
-d  dot script file, default is tmp.dot&quot;

e.g:

python ds2img.py -i t.h -f png -o t.png 
</code></pre><h3 id="TODO"><a href="#TODO" class="headerlink" title="TODO"></a>TODO</h3><p>Waiting for your advices</p>
<h3 id="Warning"><a href="#Warning" class="headerlink" title="Warning"></a>Warning</h3><ol>
<li>Not support structure contain other structure!</li>
<li>Not support multi-lines comment</li>
</ol>
<h3 id="Source"><a href="#Source" class="headerlink" title="Source"></a>Source</h3><p>You can get the latest version from:<br><a href="https://github.com/matrix207/scripts/blob/master/ds2img/ds2img.py" target="_blank" rel="external">https://github.com/matrix207/scripts/blob/master/ds2img/ds2img.py</a></p>
<pre><code>#!/usr/bin/python
#####################################################################
# Generate dot script file from c file, which have lots of structures
#
# You can get the latest version from: 
# https://github.com/matrix207/scripts/blob/master/ds2img/ds2img.py
#
# Warning: Not support structure contain other structure!
# 
# Depends:
#     1. python
#     2. graphviz
#
# History:
#    v1.0  2014-07-28  Dennis  implement generate_relation function
#                              add parse option funtion
#    v0.1  2014-07-27  Dennis  Create
#####################################################################

import os
import re
import sys
import getopt
import datetime

version = &quot;v1.0 Create by Dennis 2014-07-28&quot;
debug = 0

def is_comment(line):
    if &apos;\\&apos; in line:
        return true
    print true

# process each line
def process(line):
    print line,

def get_struct_name(line):
    print line,

def get_datetime():
    today = datetime.datetime.now()
    print today.strftime(&apos;%Y-%m-%d %H:%M:%S&apos;)

def generate_dot_header(output_file):
    if debug : 
        print &quot;generating dot header&quot;
    f=open(output_file,&apos;a+&apos;)
    print&gt;&gt;f, &quot;/**********************************************&quot;
    print&gt;&gt;f, &quot;* Auto generate by ds2img.py&quot;
    print&gt;&gt;f, &quot;* Author:  matrix207&quot;
    print&gt;&gt;f, &quot;* Date  :  %s&quot; % datetime.datetime.now().strftime(&apos;%Y-%m-%d %H:%M:%S&apos;)
    print&gt;&gt;f, &quot;**********************************************/\n&quot;
    print&gt;&gt;f, &quot;digraph DS2IMG {&quot;
    print&gt;&gt;f, &quot;    node [shape=record fontsize=12 fontname=Courier style=filled];&quot;
    print&gt;&gt;f, &quot;    edge[color=blue]; rankdir=LR;&quot;
    print&gt;&gt;f, &quot;&quot;
    f.close()

def generate_dot_end(output_file):
    if debug : 
        print &quot;generating dot end&quot;
    f=open(output_file,&apos;a+&apos;)
    print&gt;&gt;f, &quot;}&quot;
    f.close()

def generate_struct_header(output_file, struct_name):
    if debug : 
        print &quot;generating struct header&quot;
    f=open(output_file,&apos;a+&apos;)
    print&gt;&gt;f, &quot;subgraph cluster_%s {&quot; % struct_name
    print&gt;&gt;f, &quot;    node [shape=record fontsize=12 fontname=Courier style=filled];&quot;
    print&gt;&gt;f, &quot;    color = lightgray; style=filled; label = \&quot;struct %s \&quot;; edge[color=\&quot;#2e3436\&quot;];&quot; % struct_name
    print&gt;&gt;f, &quot;    node_%s [shape=record label=\&quot;&lt;f0&gt;*** struct %s ***\\&quot; % (struct_name, struct_name)
    f.close()

def generate_struct_member(output_file, index, member_name):
    if debug : 
        print &quot;generating struct member&quot;
    f=open(output_file,&apos;a+&apos;)
    print&gt;&gt;f, &quot;|&lt;f%d&gt;%s\\n\\&quot; % (index, member_name)
    f.close()

def generate_struct_end(output_file):
    if debug : 
        print &quot;generating struct end&quot;
    f=open(output_file,&apos;a+&apos;)
    print&gt;&gt;f, &quot;\&quot;];&quot;
    print&gt;&gt;f, &quot;}&quot;
    print&gt;&gt;f, &quot;&quot;
    f.close()

def generate_relation(output_file, structs_name, structs):
    if debug : 
        print &quot;generating relation&quot;
    f=open(output_file,&apos;a+&apos;)
    print&gt;&gt;f, &quot;#relation &quot;
    # structs_name contain all structure name 
    # structs      contain all structures, include structure name and it&apos;s member name
    for a in structs_name:           # structs_name[a] is structure name
        for b in structs:            # b is structure name 
            for c in structs[b]:     # c is member index, structs[b][c] is member name
                # only match structure name
                tmp = structs[b][c].split(&apos; &apos;)
                #if structs_name[a] in structs[b][c]:
                if tmp[1]==structs_name[a]:
                    #print &quot;%s contain %s\n&quot; % (b,structs_name[a])
                    #print &quot;%s:&lt;f%d&gt; -&gt; %s:f0\n&quot; % (b,c,structs_name[a])
                    print&gt;&gt;f, &quot;node_%s:&lt;f%d&gt; -&gt; node_%s:f0;&quot; % (b,c,structs_name[a])
    print&gt;&gt;f, &quot;&quot;
    f.close()

def clean_multi_space(line):
    line = re.sub(r&apos; +&apos;, &apos; &apos;, line)
    return line

def clean_array_size(line):
    line = re.sub(r&apos;\[.+\]&apos;, &apos;[]&apos;, line)
    return line

def clean_specify_dirty(line):
    line = re.sub(r&apos;\[.+&lt;&lt;.+\]&apos;, &apos;[]&apos;, line)
    return line

# handle line which has comment information
def handle_comment(line):
    pos = line.find(&quot;/*&quot;)
    if pos &gt; 0:
        line = re.sub(r&apos;/\*.+\*/&apos;, &apos;&apos;, line)
        line = line.strip()
    return line

def struct2dot(input_file, output_file):
    generate_dot_header(output_file)
    reader = open(input_file, &apos;r&apos;)
    i = 1
    structs = {}
    structs_name = {}
    while True: 
        line = reader.readline()
        if not line: 
            break
        # skip the comment line
        pos = line.find(&quot;/&quot;)
        if pos == 0:
            continue
        if pos &gt; 0:
            handle_comment(line)
        m = re.match(&apos;^struct (\w+) {$&apos;,line)
        if m: # Find structure start
            structs_name[i] = m.group(1)
            st_name = m.group(1)
            i += 1
            generate_struct_header(output_file, m.group(1))
            structs[m.group(1)] = {}
            j = 1
            while True:
                line = reader.readline()
                if not line: 
                    break
                line = line.strip();
                if len(line) == 0:
                    continue
                # skip the comment line
                pos = line.find(&quot;/&quot;)
                if pos == 0:
                    continue
                if pos &gt; 0:
                    line = handle_comment(line)
                line = clean_specify_dirty(line)
                line = clean_multi_space(line)
                m = re.match(&apos;^};$&apos;,line)
                if m: # Find structure end
                    generate_struct_end(output_file)
                    break
                structs[st_name][j] = line
                generate_struct_member(output_file, j, line)
                j += 1
    reader.close()
    generate_relation(output_file, structs_name, structs)
    generate_dot_end(output_file)

def dot2png(input_file, output_file):
    cmdline = &quot;dot -Tpng &quot; + input_file + &quot; -o &quot; + output_file
    if debug:
        print cmdline
    os.system(cmdline)

def clean_file(input_file):
    cmdline = &quot;&gt; &quot; + input_file
    os.system(cmdline)

# Test Function
def test(input_file, output_file):
    #find_comment(sys.argv[1])
    generate_dot_header(output_file)
    generate_struct_header(output_file, &quot;func_test&quot;)
    generate_struct_member(output_file, 1, &quot;int test_a_13;&quot;)
    generate_struct_member(output_file, 2, &quot;int test_a_13;&quot;)
    generate_struct_member(output_file, 3, &quot;int test_a_13;&quot;)
    generate_struct_end(output_file)
    generate_dot_end(output_file)

def find_comment(input_file):
    reader = open(input_file, &apos;r&apos;)
    while True:
        line = reader.readline()
        if len(line) == 0:
            break
        pos = line.find(&quot;/*&quot;)
        if pos&gt;=0:
            print line,
    reader.close()

def usage(bin_file):
    print &quot;Usage: %s -i INPUT_FILE -f png|svg -o OUTPUT_FILE [-d DOT_FILE]&quot; % bin_file
    print &quot;      -i  input file which have structures&quot;
    print &quot;      -f  image fomat, only support png and svg&quot;
    print &quot;      -o  output file, image file&quot;
    print &quot;      -d  dot script file, default is tmp.dot&quot;
    print &quot;  e.g:\n\tpython %s -i t.h -f png -o t.png&quot; % bin_file
    sys.exit(1)

if __name__ == &apos;__main__&apos;:
    paramlen = len(sys.argv)

    config = {  
        &quot;input&quot;:&quot;&quot;,  
        &quot;format&quot;:&quot;&quot;,  
        &quot;output&quot;:&quot;&quot;,  
        &quot;dotfile&quot;:&quot;tmp.dot&quot;,  
    }      
    opts, args = getopt.getopt(sys.argv[1:], &apos;hi:f:o:d:&apos;,
        [  
        &apos;input=&apos;,
        &apos;format=&apos;,
        &apos;output=&apos;,
        &apos;dotfile=&apos;,
        &apos;help&apos;  
        ]  
    )    

    for option, value in opts:  
        if  option in [&quot;-h&quot;,&quot;--help&quot;]:  
            usage(sys.argv[0])
        elif option in [&apos;--input&apos;, &apos;-i&apos;]:  
            config[&quot;input&quot;] = value  
        elif option in [&apos;--output&apos;, &apos;-o&apos;]:  
            config[&quot;output&quot;] = value  
        elif option in [&apos;--format&apos;, &apos;-f&apos;]:  
            config[&quot;format&quot;] = value  
        elif option in [&apos;--dotfile&apos;, &apos;-d&apos;]:  
            config[&quot;dotfile&quot;] = value  
        else:
            usage(sys.argv[0])

    if config[&quot;input&quot;] == &quot;&quot; or config[&quot;output&quot;]==&quot;&quot; or config[&quot;format&quot;]==&quot;&quot; :
        usage(sys.argv[0])


    clean_file(config[&quot;dotfile&quot;])

    struct2dot(config[&quot;input&quot;], config[&quot;dotfile&quot;])

    # generate graphic
    filename = os.path.basename(sys.argv[1]) 
    png_file = filename + &quot;.png&quot;
    dot2png(config[&quot;dotfile&quot;], config[&quot;output&quot;])

    print &quot;Done&quot;
</code></pre><h3 id="example"><a href="#example" class="headerlink" title="example"></a>example</h3><p>transfer iscsitarget-1.4.20/kernel/iscsi.h </p>
<pre><code>[dennis@localhost kernel]$ pwd
/home/dennis/work/git/iet/src/iscsitarget-1.4.20/kernel
[dennis@localhost kernel]$ ds2img.py -i iscsi.h -f png -o iscsi.png
Done
[dennis@localhost kernel]$ ds2img.py -i iscsi.h -f svg -o iscsi.svg
Done
</code></pre><p><img src="/assets/image/posts/iscsi_kernel_structs.png" alt=""></p>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://emacser.com/emacs_graphviz_ds.htm" target="_blank" rel="external">★★★使用graphviz画数据结构</a></li>
<li><a href="http://www.graphviz.org/content/datastruct" target="_blank" rel="external">graphviz for Data Structures</a></li>
<li><a href="http://gashero.iteye.com/blog/1748795" target="_blank" rel="external">使用graphviz dot来画图表</a></li>
<li><a href="http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html" target="_blank" rel="external">Python正则表达式指南</a></li>
<li><a href="http://blog.csdn.net/wangyezi19930928/article/details/25652295" target="_blank" rel="external">★★python文件操作字符串操作总结</a></li>
<li><a href="http://zhidao.baidu.com/link?url=lwqlXGEAznkWAc26v929RcbA-TuG_McqeQ2BgRWWXaiNS2KQPfU4LR-QdmJkn3eWb5Bfn6qA_7wAboaFThjUkSznQi432soyDnXbd3vPxWO" target="_blank" rel="external">用python如何匹配注释</a></li>
<li><a href="http://blog.csdn.net/xmnathan/article/details/4192821" target="_blank" rel="external">Python文件去除注释</a></li>
<li><a href="http://5iqiong.blog.51cto.com/2999926/806230" target="_blank" rel="external">★★★遍历python字典几种方法</a></li>
<li><a href="http://www.cnblogs.com/skyhacker/archive/2012/01/27/2330177.html" target="_blank" rel="external">python循环遍历字典元素</a></li>
<li><a href="http://blog.csdn.net/nrs12345/article/details/4869272" target="_blank" rel="external">Python的字典操作</a></li>
<li><a href="http://blog.csdn.net/feixin620/article/details/4209783" target="_blank" rel="external">★★★python解析ini文件</a></li>
<li><a href="http://blog.csdn.net/xiaocaiju/article/details/7590106" target="_blank" rel="external">python_getopt解析命令行输入参数的使用</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/07/28/data-structures-relation-to-image/" data-id="ciqqpe1qe00a3nmpv0yx1jmyr" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/">python</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tools/">tools</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-jni-on-linux" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/07/18/jni-on-linux/" class="article-date">
  <time datetime="2014-07-17T16:00:00.000Z" itemprop="datePublished">2014-07-18</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/language/">language</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/07/18/jni-on-linux/">jni on linux</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="1-create-Message-java-define-native-function-and-load-library"><a href="#1-create-Message-java-define-native-function-and-load-library" class="headerlink" title="1. create Message.java, define native function and load library"></a>1. create Message.java, define native function and load library</h4><pre><code>[dennis@localhost jni]$ cat Message.java
class Message
{ 
    public native int writeMessage(int type, char page_num, String content); 
    public native int getCPUTemperature(); 
    public native int getHDDTemperature(); 

    static 
    { 
        System.loadLibrary(&quot;Message&quot;); 
    }  
}
</code></pre><h4 id="2-run-‘javac-Message-java’-to-generate-Message-class"><a href="#2-run-‘javac-Message-java’-to-generate-Message-class" class="headerlink" title="2. run ‘javac Message.java’ to generate Message.class"></a>2. run ‘javac Message.java’ to generate Message.class</h4><pre><code>[dennis@localhost jni]$ javac Message.java 
</code></pre><h4 id="3-run-‘javah-Message’-to-generate-Message-h"><a href="#3-run-‘javah-Message’-to-generate-Message-h" class="headerlink" title="3. run ‘javah Message’ to generate Message.h"></a>3. run ‘javah Message’ to generate Message.h</h4><pre><code>[dennis@localhost jni]$ javah Message
[dennis@localhost jni]$ cat Message.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include &lt;jni.h&gt;
/* Header for class Message */

#ifndef _Included_Message
#define _Included_Message
#ifdef __cplusplus
extern &quot;C&quot; {
#endif
/*
 * Class:     Message
 * Method:    writeMessage
 * Signature: (ICLjava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_Message_writeMessage
  (JNIEnv *, jobject, jint, jchar, jstring);

/*
 * Class:     Message
 * Method:    getCPUTemperature
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_Message_getCPUTemperature
  (JNIEnv *, jobject);

/*
 * Class:     Message
 * Method:    getHDDTemperature
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_Message_getHDDTemperature
  (JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif
</code></pre><h4 id="4-create-Message-c-and-implement-function"><a href="#4-create-Message-c-and-implement-function" class="headerlink" title="4. create Message.c, and implement function"></a>4. create Message.c, and implement function</h4><pre><code>[dennis@localhost jni]$ cat Message.c
#include &lt;jni.h&gt;
#include &lt;stdio.h&gt;
#include &quot;Message.h&quot;

int iCpu;
int iHdd;
int iMainboard;
int iFan;

void ReadTemperatureIni()
{
    iCpu = 37;
    iHdd = 28;
    iMainboard = 30;
    iFan = 3200;
    printf(&quot;call %s %s %d\n&quot;, __FILE__, __func__, __LINE__);
}

void send_msg(const short code, const char page, const char *content) 
{
    printf(&quot;code=%d, page=%d, content=%s\n&quot;, code, page, content);
    printf(&quot;call %s %s %d\n&quot;, __FILE__, __func__, __LINE__);
}

JNIEXPORT jint JNICALL Java_Message_getCPUTemperature(JNIEnv *env, jobject obj)
{
    ReadTemperatureIni();
    return iCpu;
}

JNIEXPORT jint JNICALL Java_Message_getHDDTemperature(JNIEnv *env, jobject obj)
{
    ReadTemperatureIni();
    return iHdd;
}

JNIEXPORT jint JNICALL Java_Message_getMainboardTemperature (JNIEnv *env, jobject obj)
{
    ReadTemperatureIni();
    return iMainboard;    
}

JNIEXPORT jint JNICALL Java_Message_getCPUFanSpeed (JNIEnv *env, jobject obj)
{
    ReadTemperatureIni();
    return iFan;
}


JNIEXPORT jint JNICALL Java_Message_writeMessage 
(JNIEnv *env, jobject obj, jint type, jchar page_num, jstring content)
{
    /* c   code use: (*env)-&gt; */
    /* c++ code use: env-&gt;    */
    const jbyte *str = (const jbyte *)(*env)-&gt;GetStringUTFChars(env,content,JNI_FALSE);
    send_msg(type, page_num, (const char*)str);
    (*env)-&gt;ReleaseStringUTFChars(env,content,(const char *)str);

    return 0;
}
</code></pre><h4 id="5-start-to-compile-file-to-dynamic-library-then-copy-the-so-file-to-usr-lib64"><a href="#5-start-to-compile-file-to-dynamic-library-then-copy-the-so-file-to-usr-lib64" class="headerlink" title="5. start to compile file to dynamic library, then copy the *.so file to /usr/lib64/"></a>5. start to compile file to dynamic library, then copy the *.so file to /usr/lib64/</h4><pre><code>[dennis@localhost jni]$ cat Makefile 
CC = gcc 
CFLAGS = -Wall -shared -fPIC
# change the directory for YOUR OS
JAVA_INC = -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.5.0.1.fc20.x86_64/include/  \
           -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.5.0.1.fc20.x86_64/include/linux 
TARGET = libMessage.so

all:$(TARGET)

libMessage.so: Message.c
    $(CC) $(CFLAGS) $(JAVA_INC) -o $@ $^

.PHONY:clean
clean:
    rm -f *.class $(TARGET)
[dennis@localhost jni]$ make
gcc  -Wall -shared -fPIC -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.5.0.1.fc20.x86_64/include/ -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.5.0.1.fc20.x86_64/include/linux  -o libMessage.so Message.c
[dennis@localhost jni]$ su -c &apos;cp libMessage.so /usr/lib64&apos;
</code></pre><h4 id="6-create-Test-java-a-sample-code-to-test-interface-function"><a href="#6-create-Test-java-a-sample-code-to-test-interface-function" class="headerlink" title="6. create Test.java, a sample code to test interface function"></a>6. create Test.java, a sample code to test interface function</h4><pre><code>[dennis@localhost jni]$ cat Test.java 
public class Test
{
     public static void main(String argv[])
     {
         new Test();
     }

     public Test()
     {
         char type = 0x1F;
         char page = 1;
         String content = &quot;Test Message&quot;;
         int ret = new Message().writeMessage(type, page, content); 

         int cpu=new Message().getCPUTemperature();
         System.out.println(cpu);     

         int hdd=new Message().getHDDTemperature();
         System.out.println(hdd);
     }
}
</code></pre><h4 id="7-run-‘javac-Test-java’"><a href="#7-run-‘javac-Test-java’" class="headerlink" title="7. run ‘javac Test.java’"></a>7. run ‘javac Test.java’</h4><pre><code>[dennis@localhost jni]$ javac Test.java    
</code></pre><h4 id="8-run-‘java-Test’"><a href="#8-run-‘java-Test’" class="headerlink" title="8. run ‘java Test’"></a>8. run ‘java Test’</h4><pre><code>[dennis@localhost jni]$ java Test 
code=31, page=1, content=Test Message
call Message.c send_msg 22
call Message.c ReadTemperatureIni 16
37
call Message.c ReadTemperatureIni 16
28
</code></pre><h4 id="A-full-version-Makefile-support-compile-java-code"><a href="#A-full-version-Makefile-support-compile-java-code" class="headerlink" title="A full version Makefile, support compile java code"></a>A full version Makefile, support compile java code</h4><pre><code>#################################################################
# Makefile 
# For JNI project on Fedora x86_64 release 20
# Create by Dennis
# 2014-07-18
#
# HOW TO MAKE A JNI PROJECT
# 1. create Message.java, define native function and load library
# 2. run &apos;javac Message.java&apos; to generate Message.class
# 3. run &apos;javah Message&apos; to generate Message.h
# 4. create Message.c, and implement function
# 5. start to compile file to dynamic library, then copy the *.so 
#    file to /usr/lib64/
# 6. create Test.java, a sample code to test interface function
# 7. run &apos;javac Test.java&apos; to generate Test.class
# 7. run &apos;java Test&apos; 
#################################################################
CC = gcc 
JAVAC = javac
CFLAGS = -Wall -shared -fPIC
# change the directory for YOUR OS
JAVA_INC = -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.5.0.1.fc20.x86_64/include/  \
           -I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.5.0.1.fc20.x86_64/include/linux 
TARGET = libMessage.so Test.class

all:$(TARGET)

libMessage.so: Message.c
    $(CC) $(CFLAGS) $(JAVA_INC) -o $@ $^

Test.class: 
    $(JAVAC) Test.java    

.PHONY:clean
clean:
    rm -f *.class $(TARGET)
</code></pre><h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4><ul>
<li><a href="http://www.cnblogs.com/bastard/archive/2012/05/17/2506877.html" target="_blank" rel="external">Linux下 JNI的使用</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/07/18/jni-on-linux/" data-id="ciqqpe1q9009xnmpv8a0kx48t" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/java/">java</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-storage-technology" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/07/18/storage-technology/" class="article-date">
  <time datetime="2014-07-17T16:00:00.000Z" itemprop="datePublished">2014-07-18</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/storage/">storage</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/07/18/storage-technology/">storage technology</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>###<a href="http://blog.csdn.net/liuaigui/article/details/5333752" target="_blank" rel="external">从研发角度谈存储技术的学习</a></p>
<p>对于研发人员，存储技术的学习内容非常之多。我根据自己的理解，把它们大致分为以下8项内容：</p>
<ol>
<li>系统管理：UNIX/Linux/Windows操作系统管理，要求熟悉甚至精通。</li>
<li>开发技术：C/C++，网络编程，多进程/多线程，进程间通信。如果能掌握内核开发、驱<br>动程序开发则更佳。</li>
<li>存储基础：磁盘、RAID阵列、文件系统等存储相关硬件和软件的安装、配置、调试。</li>
<li>存储系统：RAID, DAS, SAN, NAS, CAS等，对存储系统的原理以及实现技术熟悉。</li>
<li>存储协议：TCP/IP, SCSI, iSCSI, NFS/CIFS等, 熟悉这些存储相关协议。</li>
<li>文件系统：VFS, EXTx/NTFS/FAT32等磁盘文件系统, NFS/CIFS网络文件系统, Lustre/GFS/AFS<br>等分布式文件系统，掌握原理和实现技术，能够阅读源码则更好。</li>
<li>存储技术：Deduplication, SSD, HSM, Virtualization, Snapshot, Replication, CDP<br>, VTL, Thin Provision等等，尽量多跟踪最新存储技术进展，多多益善。</li>
<li>存储架构：掌握不同行业的存储需求，能够根据实际需求提出存储解决方案，并进行存<br>储系统架构、设计和实现。</li>
</ol>
<p>存储研发人员成长大致可分为四个级别：</p>
<ol>
<li>存储初级研发：掌握1、2、3项存储内容，在中高级存储研发指导下，可以进行存储研发工作。</li>
<li>存储中级研发：掌握4、5项存储内容，可以带领团队进行研发工作，并指导初级研发。</li>
<li>存储高级研发：掌握6、7项存储内容，可以进行存储新技术的研究，对现有存储系统优<br>化改进，原型系统开发。</li>
<li>存储研发专家：掌握8项存储内容，存储前沿技术研究，存储系统规划与架构，对存储发<br>展趋势有着很好的理解和洞察。</li>
</ol>
<p>10000小时法则 (The 10,OOO Hour Rule)，简单地说，任何人要在任何领域出类拔萃，脱颖<br>而出，都需要认真投入10000小时以上。10000小时是一个突破的临界点。以每天10个小时算<br>，10000小时相当于三年。也就是说，要做成功一件事情，你就要每天10小时投入，持续3年<br>。如果每天只有5小时，那么需要6年。如果每天3小时，则需要10年。因此，如果想成为存<br>储领域的专家，没有什么捷径可走，只有坚持学习、实践、思考。3年、5年、8年、10年后<br>，只要你仍在追求既定目标，定会有所成就。</p>
<p>“厚积而薄发”，与所有存储同行共勉！</p>
<p>###<a href="http://blog.csdn.net/liuaigui/article/details/5368300" target="_blank" rel="external">存储学习之路</a></p>
<ul>
<li>0、存储入门</li>
</ul>
<p>　领路人的作用很大，这个人可能是你做研究生的导师，或者工作中的tutor，或者是朋友、<br>同事。指点迷津，学习和研究过程中将少走很多弯路，经验的价值这在这里体现。如果你是<br>存储初学者，赶快去寻找你的领路人。当然自学成才的例子举不胜举，还是靠自己来做权衡。</p>
<ul>
<li>1、存储图书</li>
</ul>
<p>　学习存储的基础理论最直接的方法就是读书。相对于计算与网络技术，存储技术发展是相<br>对落后的，因此图书方面也要少很多，国内的更少，而且大多是翻译或改编的。我读过的国<br>内存储图书有：</p>
<ul>
<li>网络存储技术    清华大学出版社</li>
<li>网络存储技术导论    清华大学出版社</li>
<li>SAN存储区域网络    机械工业出版社</li>
<li>数据存储备份与灾难恢复    电子工业出版社</li>
<li>基于对象的网络存储    电子工业出版社</li>
<li>IPSAN权威指南    中国电力出版社</li>
<li>成就存储专家之路    清华大学出版社</li>
<li>信息存储与管理    人民邮电出版社</li>
<li>大话存储    清华大学出版社    </li>
<li>数据重现    清华大学出版社</li>
</ul>
<ul>
<li>2、存储资源</li>
</ul>
<p>　网络资源也是学习存储的重要资源，而且能够很好地跟踪存储的最近发展动态。我常访问的URL有：</p>
<ul>
<li>InfoStor: <a href="http://www.infostor.com" target="_blank" rel="external">http://www.infostor.com</a>  </li>
<li>SINA: <a href="http://www.snia.org/home" target="_blank" rel="external">http://www.snia.org/home</a>  </li>
<li>Gartner: <a href="http://www.gartner.com/technology/home.jsp" target="_blank" rel="external">http://www.gartner.com/technology/home.jsp</a>  </li>
<li>SanSky: <a href="http://www.sansky.net/" target="_blank" rel="external">http://www.sansky.net/</a>  </li>
<li>DoStor: <a href="http://www.dostor.com/" target="_blank" rel="external">http://www.dostor.com/</a>  </li>
<li>WatchStor: <a href="http://www.watchstor.com/" target="_blank" rel="external">http://www.watchstor.com/</a>  </li>
</ul>
<p>另外还有一些国际上存储会议，比如：</p>
<ul>
<li>SDC，Storage Developer Conference　(2009,<a href="http://www.snia.org/events/storage-developer2009/presentations" target="_blank" rel="external">http://www.snia.org/events/storage-developer2009/presentations</a>)</li>
<li>FAST, File and Storage Technologies (<a href="http://www.usenix.org/events/fast/" target="_blank" rel="external">http://www.usenix.org/events/fast/</a>)</li>
</ul>
<ul>
<li><p>3、存储实践</p>
<p>大学中我们最缺是估计就是实践。实践可以帮助我们更深刻地理解和掌握理论，并且获得<br>将理论进行实现和应用的能力。实践有很多方式，比如自己动手进行存储软硬件的调试、存<br>储系统集优化改进、开发一些软件、阅读存储软件源码等等。实践这个东西，多多益善，尽<br>量找机会多做。源代码除了Linux kernel外，www.sourceforge.net是最好的去处，可以读<br>VFS、EXT2/3/4、Soft RAID、LVM、FDISK、NFS/CIFS、SCSI/iSCSI、FUSE、AFS、LUSTRE等等。</p>
</li>
<li><p>4、存储交流</p>
</li>
</ul>
<p>　牛人大多都是喜欢与人分享的，你也不要担心分享自己的东西，别人就超越你了。能把自<br>己的东西说得让别人明白，实际上对自己也是一个提升。物以类聚，人以群分。现在网络不<br>要太方便，找一群兴趣相投的人，多多交流，大家共同进步就何等的好事。而且同时可以建<br>立人脉，说不定哪天志同道合的人，就一起做共事或创业了。</p>
<ul>
<li>5、存储思考</li>
</ul>
<p>　学而不思则罔，思而不学则贻。当已经掌握了一些存储理论和实践后，我们可能会遇到发<br>展的瓶颈，需要选择一两个方向进行深入学习和研究。这样我们才能有精力去分析和思考理<br>论和技术上优点与不足，继而不断实践和思考。从而就有可能达到一个更高的层次，并且可<br>能会发现一些机会。</p>
<ul>
<li>6、存储经验</li>
</ul>
<p>　我们常常看到招聘信息上要求8－10年的相关工作经验。不管是失败还是成功的经验，对<br>未来的工作都很有意义，尤其是失败的经验，将大大提成功的几率。对搞存储的来说，最好<br>能找机会进入存储行业的公司或研究机构工作，这对经验的提升非常重要。因为这是正规军<br>，是适应市场用户需求的，而自己的学习和研究，都是出自自身需求的。如果你在公司工作<br>，或者自己创业，用户需求是做产品的根本出发点，这个意识要尽早培养。</p>
<ul>
<li>7、存储趋势</li>
</ul>
<p>　熟悉历史，把握现在，预测未来。一旦我们对存储技术的过去和现在都非常熟悉和深入理<br>解，那么我们就有可能正确地对存储的未来趋势进行分析和预测，掌握先机和商机。这种人<br>是大牛，或许我们很难达到这个层次，但至少大牛提出很多新的观点和概念时，我们能很快<br>理解和认同。</p>
<ul>
<li>8、存储创新</li>
</ul>
<p>　创新是需要前提条件的，如果没有前面的学习、实践、思考，存储创新根本无从谈起。创<br>新可能是理论创新和技术创新，主要出发点就是要解决和改进目前理论或技术上存在的缺陷<br>与不足，这自然就要求我们对现有的东西非常熟悉。达到可以深入思考和寻求创新的层次，<br>我想大概规律性的东西就很少了。成功有时是需要点运气，但前期的功课是要做好的，成功<br>还是眷顾有充分准备的人的。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/07/18/storage-technology/" data-id="ciqqpe1qb00a0nmpvsky6hpye" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/storage/">storage</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-ipmi" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/07/09/ipmi/" class="article-date">
  <time datetime="2014-07-08T16:00:00.000Z" itemprop="datePublished">2014-07-09</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/07/09/ipmi/">ipmi</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Introduce"><a href="#Introduce" class="headerlink" title="Introduce"></a>Introduce</h3><p>The <strong>Intelligent Platform Management Interface (IPMI)</strong> is a standardized computer<br>system interface used by system administrators for out-of-band management of<br>computer systems and monitoring of their operation. It is a way to manage a<br>computer that may be powered off or otherwise unresponsive by using a network<br>connection to the hardware rather than to an operating system or login shell.</p>
<p><img src="http://upload.wikimedia.org/wikipedia/commons/f/f2/IPMI-Block-Diagram.png" alt=""></p>
<h3 id="Why-use"><a href="#Why-use" class="headerlink" title="Why use"></a>Why use</h3><p>Use lm-sensor? </p>
<pre><code>[root@localhost ~]# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:       +27.8°C  (crit = +106.0°C)                  
temp2:       +29.8°C  (crit = +106.0°C)                  

coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +35.0°C  (high = +85.0°C, crit = +105.0°C)  
Core 0:        +32.0°C  (high = +85.0°C, crit = +105.0°C)  
Core 1:        +31.0°C  (high = +85.0°C, crit = +105.0°C)  
</code></pre><p>Use dmidecode?</p>
<h3 id="Install"><a href="#Install" class="headerlink" title="Install"></a>Install</h3><p>On Centos 6.5</p>
<pre><code>[root@localhost ~]# yum install OpenIPMI -y
[root@localhost ~]# yum install ipmitool -y
[root@localhost ~]# chkconfig ipmi on
[root@localhost ~]# service ipmi start
Starting ipmi drivers:                                     [  OK  ]
[root@localhost ~]# ls -l /dev/ipmi*
crw-rw----. 1 root root 245, 0 Feb  5 14:18 /dev/ipmi0
[root@localhost ~]# lsmod | grep ipmi
ipmi_devintf            7729  0 
[root@localhost ~]# modinfo ipmi_devintf
filename:       /lib/modules/2.6.32-431.el6.x86_64/kernel/drivers/char/ipmi/ipmi_devintf.ko
alias:          platform:ipmi_si
description:    Linux device interface for the IPMI message handler.
author:         Corey Minyard &lt;minyard@mvista.com&gt;
license:        GPL
srcversion:     592518D3E7F47DFC4EBEC9F
depends:        
vermagic:       2.6.32-431.el6.x86_64 SMP mod_unload modversions 
parm:           ipmi_major:Sets the major number of the IPMI device.  By default, or if you set it to zero, it will choose the next available device.  Setting it to -1 will disable the interface.  Other values will set the major device number to that value. (int)
[root@localhost ~]#
</code></pre><h3 id="Use"><a href="#Use" class="headerlink" title="Use"></a>Use</h3><ol>
<li><p><strong>To check firmware version</strong></p>
<pre><code>[root@localhost ~]# ipmitool mc info
Device ID                 : 20
Device Revision           : 1
Firmware Revision         : 0.8
IPMI Version              : 2.0
Manufacturer ID           : 9091
Manufacturer Name         : Unknown (0x2383)
Product ID                : 289 (0x0121)
Product Name              : Unknown (0x121)
Device Available          : yes
Provides Device SDRs      : no
Additional Device Support :
    Sensor Device
    SDR Repository Device
    SEL Device
    FRU Inventory Device
    IPMB Event Receiver
    Chassis Device
Aux Firmware Rev Info     : 
    0x00
    0x37
    0x00
    0x00
</code></pre></li>
<li><p><strong>Show sensor output</strong></p>
<pre><code>[root@localhost ~]# ipmitool sdr list
CPU0_TEMP        | 25 degrees C      | ok
VCORE_CPU0       | 0.83 Volts        | ok
+1.5V_DDR3       | 1.52 Volts        | ok
PCH              | 1.04 Volts        | ok
+3.3V            | 3.42 Volts        | ok
+5V              | 5.14 Volts        | ok
+5VSB            | 5.07 Volts        | ok
VBAT             | 3.34 Volts        | ok
+12V_MONITOR     | 12.40 Volts       | ok
THERMAL01        | 35 degrees C      | ok
THERMAL02        | 31 degrees C      | ok
CPU_FAN1         | 5900 RPM          | ok
SYS_FAN1         | 0 RPM             | nr
SYS_FAN2         | 0 RPM             | nr
SYS_FAN3         | 0 RPM             | nr
Watchdog         | Not Readable      | ns
[root@localhost ~]# ipmitool sdr type list
Sensor Types:
    Temperature                 Voltage                  
    Current                     Fan                      
    Physical Security           Platform Security        
    Processor                   Power Supply             
    Power Unit                  Cooling Device           
    Other                       Memory                   
    Drive Slot / Bay            POST Memory Resize       
    System Firmwares            Event Logging Disabled   
    Watchdog                    System Event             
    Critical Interrupt          Button                   
    Module / Board              Microcontroller          
    Add-in Card                 Chassis                  
    Chip Set                    Other FRU                
    Cable / Interconnect        Terminator               
    System Boot Initiated       Boot Error               
    OS Boot                     OS Critical Stop         
    Slot / Connector            System ACPI Power State  
    Watchdog                    Platform Alert           
    Entity Presence             Monitor ASIC             
    LAN                         Management Subsystem Health
    Battery                     Session Audit            
    Version Change              FRU State                
[root@localhost ~]# ipmitool sdr type Fan
CPU_FAN1         | 31h | ok  |  7.1 | 5900 RPM
SYS_FAN1         | 32h | lnr |  7.2 | 0 RPM
SYS_FAN2         | 33h | lnr |  7.5 | 0 RPM
SYS_FAN3         | 34h | lnr |  7.6 | 0 RPM
[root@localhost ~]# ipmitool sdr type Temperature
CPU0_TEMP        | 21h | ok  |  7.1 | 25 degrees C
THERMAL01        | 23h | ok  |  7.1 | 35 degrees C
THERMAL02        | 24h | ok  |  7.1 | 31 degrees C
</code></pre></li>
<li><p><strong>Display/reset password for default root user (userid ‘2’)</strong></p>
<pre><code>ipmitool user list 1
ipmitool user set password 2 &lt;new_password&gt;
</code></pre></li>
</ol>
<p><strong>Display/configure lan settings</strong></p>
<pre><code>ipmitool lan print 1
ipmitool lan set 1 ipsrc [ static | dhcp ]
ipmitool lan set 1 ipaddr 192.168.1.101
ipmitool lan set 1 netmask 255.255.255.0
ipmitool lan set 1 defgw ipaddr 192.168.1.254
</code></pre><h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://www.chenshake.com/summary-of-ipmi/" target="_blank" rel="external">IPMI总结</a></li>
<li><a href="http://www.openfusion.net/linux/ipmi_on_centos" target="_blank" rel="external">IPMI on CentOS/RHEL</a></li>
<li><a href="http://blog.csdn.net/goodluckwhh/article/details/9955715" target="_blank" rel="external">open ipmi内核实现简介</a></li>
<li><a href="http://www.ibm.com/developerworks/cn/linux/l-ipmi/index.html" target="_blank" rel="external">使用ipmitool实现Linux系统下对服务器的ipmi管理</a></li>
<li><a href="http://sourceforge.net/projects/openipmi/" target="_blank" rel="external">openipmi on sourceforge</a></li>
<li><a href="http://blog.csdn.net/huzhenwei/article/details/6300472" target="_blank" rel="external">在Linux系统上配置IPMI来远程控制服务器</a></li>
<li><a href="http://wenku.baidu.com/link?url=Sk-pIPKAOIrUVwg1L00GHmIMPjuFsqj13308opURYRARvyQh-pzOEOUm5_uwk7C-eBqGb91iXhacQ6eTIFG8AQ8YO9ZUjne6J_T0JES5ihy" target="_blank" rel="external">Linux平台下IPMI驱动程序设计与实现</a></li>
<li><a href="http://openipmi.sourceforge.net/IPMI.pdf" target="_blank" rel="external">IPMI - Gentle Introduction with OpenIPM</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/07/09/ipmi/" data-id="ciqqpe1q6009unmpvc7qis5p8" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tools/">tools</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-gnu-linux-program" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/28/gnu-linux-program/" class="article-date">
  <time datetime="2014-06-27T16:00:00.000Z" itemprop="datePublished">2014-06-28</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/linux/">linux</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/28/gnu-linux-program/">GNU Linux program</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h3 id="Part-1-Linux-program-tools"><a href="#Part-1-Linux-program-tools" class="headerlink" title="Part 1 Linux program tools"></a>Part 1 Linux program tools</h3><h4 id="GNU-cc"><a href="#GNU-cc" class="headerlink" title="GNU cc"></a>GNU cc</h4><pre><code>gcc myapp.c -L/home/fred/lib -I/home/fred/include -lnew -o myapp

gcc cursesapp.c -lncurse -static -o cursesapp

/*
 * pisqrt.c - Calculate the square of PI 100,000,000
 * times
 */
#include &lt;stdio.h&gt;
#include &lt;math.h&gt;

int main(void)
{
    double pi = M_PI; /* Defined in &lt;math.h&gt; */
    double pisqrt;
    long i;

    for (i=0; i&lt;10000000; ++i) {
        pisqrt = sqrt(pi);
    }

    return 0;
}
</code></pre><h4 id="GNU-make"><a href="#GNU-make" class="headerlink" title="GNU make"></a>GNU make</h4><pre><code>auto variable
$@
$&lt;
$^
$?
$(@D)
$(@F)
</code></pre><h4 id="GNU-autoconf"><a href="#GNU-autoconf" class="headerlink" title="GNU autoconf"></a>GNU autoconf</h4><pre><code>configure.in
AC_INIT(unique_file_in_source_dir)
AC_OUTPUT([file...[,extra_cmds[,init_cmds]]])

AC_INIT
    Test program
    Test function library
    Test header
    Test type defined
    Test structure
    Test compile
    Test library function
    Test system call
AC_OUTPUT

autoscan
ifnames
</code></pre><h4 id="patch"><a href="#patch" class="headerlink" title="patch"></a>patch</h4><pre><code>diff
patch

diff -c sigrot.1 sigrot.2 &gt; sigrot.path
patch -p0 &lt; sigrot.patch
</code></pre><h4 id="GDB"><a href="#GDB" class="headerlink" title="GDB"></a>GDB</h4><h4 id="assert"><a href="#assert" class="headerlink" title="assert"></a>assert</h4><pre><code>#include &lt;assert.h&gt;
void assert (int expression);
</code></pre><h4 id="macro"><a href="#macro" class="headerlink" title="macro"></a>macro</h4><pre><code>__LINE__
__FILE__
__FUNCTION__
</code></pre><h4 id="system-header-and-error"><a href="#system-header-and-error" class="headerlink" title="system header and error"></a>system header and error</h4><pre><code>stdlib.h    void abort(void);
stdlib.h    void exit(int status);
stdlib.h    int atexit(void (*fcn) (void));
stdio.h        void perror(const char *s);
string.h    char *strerror(int errnum);
errno.h        int errno;

void clearerr(FILE *stream);
int feof(FILE *stream);
int ferror(FILE *stream);
</code></pre><h4 id="system-log"><a href="#system-log" class="headerlink" title="system log"></a>system log</h4><pre><code>klogd
syslogd

#include &lt;syslog.h&gt;
void syslog(int priority, char *format, ...);

syslog(LOG_WARNING | LOG_USER, &quot;unable to open file %s *** %m\n&quot;, fname);

for shell:
logger [-s] [-f file] [-p pri] [-t tag] [-u socket] [message ...]
</code></pre><h4 id="dynamic-library"><a href="#dynamic-library" class="headerlink" title="dynamic library"></a>dynamic library</h4><pre><code>nm [options] file
ar {dmpgrtx} [member] archive files ...
ldd [options] file
ldconfig [options] [libs]

gcc -fPIC -g -c liberrr.c -o liberr.o
gcc -g -shared -Wl,-soname,liberr.so -o liberr.so.1.0.0 liberr.o -lc
ln -s liberr.so.1.0.0 liberr.so.1

void *dlopen(const char *filename, int flag);
void *dlsym(void *handle, char *symbol);
const char *dlerror(void);
int dlclose(void *handle);

gcc -g -Wall dltest.c -o dltest -ldl
</code></pre><hr>
<h3 id="Part-2-System-Program"><a href="#Part-2-System-Program" class="headerlink" title="Part 2 System Program"></a>Part 2 System Program</h3><h4 id="File-I-O"><a href="#File-I-O" class="headerlink" title="File I/O"></a>File I/O</h4><pre><code>open
create
close
read
write
ftruncate
lseek
fsync
fstat
fchown
fchmod
flock
fcntl
dup
dup2
slect
ioctl

fopen
freopen
fclose

feof
ferror
clearer
fileno

printf
fprintf
sprintf
snprintf

vprintf
vfprintf
vsprintf
vsnprintf

scanf
fscanf
sscanf

vscanf
vsscanf
vfscanf

fseek
ftell
fgetpos
fsetpos
rewind

fflush
setbuf
setbuffer
setlinebuf
setvbuf

remove
rename

tmpfile
tmpnam

mkstemp

getcwd
chdir
fchdir

mkdir
rmdir

opendir
readdir
rewinddir
closedir
</code></pre><h4 id="Process-control"><a href="#Process-control" class="headerlink" title="Process control"></a>Process control</h4><pre><code>system
fork
exec
popen
pclose

wait
waitpid

exit
abort
kill

alarm
pause

sigemptyset
sigfillset
sigaddset
sigdelset
sigismember

sigprocmask
sigaction
sgpending

sched_setscheduler
sched_getscheduler
sched_get_priority_max
sched_get_priority_min
getpriority
setpriority
nice
</code></pre><h4 id="Thread"><a href="#Thread" class="headerlink" title="Thread"></a>Thread</h4><pre><code>_clone

pthread_create
pthread_exit
pthread_join
pthread_detach
pthread_atfork
pthread_cancel
pthread_setcancelstate
pthread_setcanceltype
pthread_testcancel

pthread_cleanup_push
pthread_cleanup_pop
pthread_cleanup_push_defer_np
pthread_cleanup_pop_restore_np

pthread_cond_signal
pthread_cond_broadcast
pthread_cond_wait
pthread_cond_timewait
pthread_cond_destroy

pthread_equal

pthread_attr_

pthread_mutex_
</code></pre><h4 id="memory-manager"><a href="#memory-manager" class="headerlink" title="memory manager"></a>memory manager</h4><pre><code>malloc
calloc
realloc
free

mmap
mumap
msync
mprotect
mlock
munlock
mlockall
munlockall
</code></pre><hr>
<h4 id="Part-3-IPC-and-Network-program"><a href="#Part-3-IPC-and-Network-program" class="headerlink" title="Part 3 IPC and Network program"></a>Part 3 IPC and Network program</h4><h4 id="IPC"><a href="#IPC" class="headerlink" title="IPC"></a>IPC</h4><pre><code>pipe
popen
pclose

mkfifo

shmget
shmat
shmdt

msgget
msgsnd
msgrcv
msgctl

semget
semop
semctl

setsid

openlog
closelog
syslog
</code></pre><h4 id="Netwrok"><a href="#Netwrok" class="headerlink" title="Netwrok"></a>Netwrok</h4><pre><code>socket
bind
listen
connect
accept
read
write
recv_from
send_to

sendfile
close

netstat 
tcpdump

multicast
</code></pre><hr>
<h3 id="Part-4-GUI"><a href="#Part-4-GUI" class="headerlink" title="Part 4 GUI"></a>Part 4 GUI</h3><pre><code>terminal

ncurses

x windows

GTK+ GUI

Qt GUI

OpenGL Mesa 3D
</code></pre><hr>
<h3 id="Part-5-Special-program-technology"><a href="#Part-5-Special-program-technology" class="headerlink" title="Part 5 Special program technology"></a>Part 5 Special program technology</h3><h4 id="GNU-Bash"><a href="#GNU-Bash" class="headerlink" title="GNU Bash"></a>GNU Bash</h4><h4 id="Device-Driver"><a href="#Device-Driver" class="headerlink" title="Device Driver"></a>Device Driver</h4><hr>
<h3 id="Part-6"><a href="#Part-6" class="headerlink" title="Part 6"></a>Part 6</h3><h4 id="RPM"><a href="#RPM" class="headerlink" title="RPM"></a>RPM</h4><h4 id="Licence"><a href="#Licence" class="headerlink" title="Licence"></a>Licence</h4><ol>
<li>MIT</li>
<li>BSD</li>
<li>GNU</li>
</ol>
<hr>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="">GNU Linux program</a></li>
<li><a href="http://www.advancedlinuxprogramming.com/alp-folder/advanced-linux-programming.pdf" target="_blank" rel="external">Advanced linux program</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/28/gnu-linux-program/" data-id="ciqqpe1q3009rnmpvxvv5rb7c" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/linux/">linux</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-sdn" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/26/sdn/" class="article-date">
  <time datetime="2014-06-25T16:00:00.000Z" itemprop="datePublished">2014-06-26</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/others/">others</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/26/sdn/">SDN</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p><img src="http://upload.wikimedia.org/wikipedia/commons/0/0b/Sdn-3layers.gif" alt="SDN-3Layers"></p>
<p><strong>SDN 3Layers</strong></p>
<hr>
<p><img src="http://upload.wikimedia.org/wikipedia/commons/d/d0/SDN-architecture-overview.png" alt="SDN-architecture-overview"></p>
<p><strong>SDN Architecture Overview</strong></p>
<hr>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://en.wikipedia.org/wiki/Software-defined_networking" target="_blank" rel="external">Software Defined Networking</a></li>
<li><a href="http://www.ithome.com.tw/node/77353" target="_blank" rel="external">新一代網路架構SDN顛覆傳統網路的控制模式</a></li>
<li><a href="http://www.ithome.com.tw/node/77354" target="_blank" rel="external">3種SDN架構的產品策略</a></li>
<li><a href="http://www.h3c.com.cn/Solution/VAN/Home/Project_features/201303/778755_30004_0.htm" target="_blank" rel="external">SDN软件定义网络</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/26/sdn/" data-id="ciqqpe1px009onmpvc8xsin2e" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/others/">others</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <a class="extend prev" rel="prev" href="/page/6/">&laquo; __('prev')</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/5/">5</a><a class="page-number" href="/page/6/">6</a><span class="page-number current">7</span><a class="page-number" href="/page/8/">8</a><a class="page-number" href="/page/9/">9</a><span class="space">&hellip;</span><a class="page-number" href="/page/18/">18</a><a class="extend next" rel="next" href="/page/8/">__('next') &raquo;</a>
  </nav>
</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Catégories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/english/">english</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/">kernel</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/language/">language</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/math/">math</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/network/">network</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/others/">others</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/person/">person</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/program/">program</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/source/">source</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/storage/">storage</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/windows/">windows</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Mot-clés</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FAQ/">FAQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IRC/">IRC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Translation/">Translation</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/api/">api</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/assembly/">assembly</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/awk/">awk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/batch/">batch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/book/">book</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/crash/">crash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dot/">dot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/driver/">driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/emacs/">emacs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exploit/">exploit</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/filesystem/">filesystem</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flowchart/">flowchart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gcc/">gcc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/google/">google</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hosts/">hosts</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/job/">job</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kernel/">kernel</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lisp/">lisp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lua/">lua</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/makefile/">makefile</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/malloc/">malloc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/math/">math</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maxima/">maxima</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory/">memory</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory-overflow/">memory overflow</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mtrace/">mtrace</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netdisk/">netdisk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/others/">others</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/performance/">performance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/person/">person</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rsync/">rsync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sed/">sed</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shell/">shell</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/skype/">skype</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sms/">sms</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/source/">source</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh/">ssh</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/">stack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/storage/">storage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/study/">study</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svn/">svn</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sync/">sync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time/">time</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/valgrind/">valgrind</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vi/">vi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/virtual/">virtual</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wget/">wget</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wireshark/">wireshark</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/write/">write</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xml/">xml</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Nuage de mot-clés</h3>
    <div class="widget tagcloud">
      <a href="/tags/FAQ/" style="font-size: 10px;">FAQ</a> <a href="/tags/IRC/" style="font-size: 10px;">IRC</a> <a href="/tags/Translation/" style="font-size: 13px;">Translation</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/api/" style="font-size: 10px;">api</a> <a href="/tags/assembly/" style="font-size: 10px;">assembly</a> <a href="/tags/awk/" style="font-size: 11px;">awk</a> <a href="/tags/batch/" style="font-size: 14px;">batch</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/book/" style="font-size: 10px;">book</a> <a href="/tags/c/" style="font-size: 16px;">c</a> <a href="/tags/c/" style="font-size: 19px;">c++</a> <a href="/tags/cache/" style="font-size: 10px;">cache</a> <a href="/tags/crash/" style="font-size: 10px;">crash</a> <a href="/tags/database/" style="font-size: 17px;">database</a> <a href="/tags/debug/" style="font-size: 12px;">debug</a> <a href="/tags/dot/" style="font-size: 10px;">dot</a> <a href="/tags/driver/" style="font-size: 10px;">driver</a> <a href="/tags/emacs/" style="font-size: 11px;">emacs</a> <a href="/tags/exploit/" style="font-size: 10px;">exploit</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/filesystem/" style="font-size: 12px;">filesystem</a> <a href="/tags/flowchart/" style="font-size: 10px;">flowchart</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 12px;">git</a> <a href="/tags/google/" style="font-size: 11px;">google</a> <a href="/tags/graphviz/" style="font-size: 11px;">graphviz</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/hosts/" style="font-size: 10px;">hosts</a> <a href="/tags/iscsi/" style="font-size: 14px;">iscsi</a> <a href="/tags/java/" style="font-size: 10px;">java</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/job/" style="font-size: 10px;">job</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/kernel/" style="font-size: 14px;">kernel</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lisp/" style="font-size: 10px;">lisp</a> <a href="/tags/lua/" style="font-size: 10px;">lua</a> <a href="/tags/makefile/" style="font-size: 10px;">makefile</a> <a href="/tags/malloc/" style="font-size: 10px;">malloc</a> <a href="/tags/math/" style="font-size: 11px;">math</a> <a href="/tags/maxima/" style="font-size: 10px;">maxima</a> <a href="/tags/memory/" style="font-size: 11px;">memory</a> <a href="/tags/memory-overflow/" style="font-size: 10px;">memory overflow</a> <a href="/tags/mtrace/" style="font-size: 10px;">mtrace</a> <a href="/tags/netdisk/" style="font-size: 10px;">netdisk</a> <a href="/tags/network/" style="font-size: 20px;">network</a> <a href="/tags/others/" style="font-size: 18px;">others</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a> <a href="/tags/performance/" style="font-size: 16px;">performance</a> <a href="/tags/person/" style="font-size: 11px;">person</a> <a href="/tags/protobuf/" style="font-size: 11px;">protobuf</a> <a href="/tags/python/" style="font-size: 10px;">python</a> <a href="/tags/rsync/" style="font-size: 10px;">rsync</a> <a href="/tags/sed/" style="font-size: 11px;">sed</a> <a href="/tags/shell/" style="font-size: 15px;">shell</a> <a href="/tags/skype/" style="font-size: 11px;">skype</a> <a href="/tags/sms/" style="font-size: 10px;">sms</a> <a href="/tags/source/" style="font-size: 11px;">source</a> <a href="/tags/ssh/" style="font-size: 10px;">ssh</a> <a href="/tags/stack/" style="font-size: 10px;">stack</a> <a href="/tags/storage/" style="font-size: 15px;">storage</a> <a href="/tags/study/" style="font-size: 10px;">study</a> <a href="/tags/svn/" style="font-size: 11px;">svn</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/test/" style="font-size: 11px;">test</a> <a href="/tags/time/" style="font-size: 10px;">time</a> <a href="/tags/tools/" style="font-size: 16px;">tools</a> <a href="/tags/valgrind/" style="font-size: 10px;">valgrind</a> <a href="/tags/vi/" style="font-size: 10px;">vi</a> <a href="/tags/vim/" style="font-size: 14px;">vim</a> <a href="/tags/virtual/" style="font-size: 11px;">virtual</a> <a href="/tags/wget/" style="font-size: 10px;">wget</a> <a href="/tags/windows/" style="font-size: 11px;">windows</a> <a href="/tags/wireshark/" style="font-size: 10px;">wireshark</a> <a href="/tags/write/" style="font-size: 13px;">write</a> <a href="/tags/xml/" style="font-size: 10px;">xml</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/02/">February 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/12/">December 2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/09/">September 2012</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Articles récents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/07/17/how-to-implement-malloc/">如何实现一个malloc</a>
          </li>
        
          <li>
            <a href="/2016/07/17/study-grep-more/">grep工作原理</a>
          </li>
        
          <li>
            <a href="/2016/07/17/2016-04-13-malloc/">malloc</a>
          </li>
        
          <li>
            <a href="/2016/04/27/include-what-you-use/">使用IWYU整理头文件引用</a>
          </li>
        
          <li>
            <a href="/2016/04/24/understand-gcc-assembly-output/">understand gcc assembly output</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 Matrix207<br>
      Propulsé by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>